package com.zzyl.controller.manager;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.BedDto;
import com.zzyl.dto.RoomDto;
import com.zzyl.entity.Bed;
import com.zzyl.service.BedService;
import com.zzyl.vo.BedVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/bed")
public class BedController {

    @Autowired
    private BedService bedService;

    @PostMapping("/create")
    public ResponseResult<Void> addBed(@RequestBody BedDto bedDto) {
        bedService.addBed(bedDto);
        return ResponseResult.success();
    }

    @GetMapping("/read/{id}")
    public ResponseResult<BedVo> getById(@PathVariable Long id) {
        BedVo bedVo = bedService.selectByPrimaryKey(id);
        return ResponseResult.success(bedVo);
    }

    @DeleteMapping("/delete/{id}")
    public ResponseResult<Void> deleteFloor(@PathVariable Long id) {
        bedService.deleteBed(id);
        return ResponseResult.success();
   }

   @PutMapping("/update")
   public ResponseResult<Void> updateBed(@RequestBody BedDto bedDto) {
       bedService.updateBed(bedDto);
       return ResponseResult.success();
   }


}
